How to write a structure into a file in C